package com.lorenzogao.jetpackexample

import android.app.Activity
import android.content.Context
import android.content.Intent
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.preferencesDataStore

/**
 *  LorenzoGao
 *  2021/4/21-2:31 PM
 *  */


inline  fun <reified T : Activity> Activity.startActivity(){
    startActivity(Intent(this,T::class.java))
}

// preferencesDataStore 创建的属性委托来创建 Datastore<Preferences> 实例  DataStore 保留为单例
val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "settings")